#ifndef COMPILE_PRINCIPLE_SYMBOL_TABLE
#define COMPILE_PRINCIPLE_SYMBOL_TABLE
#include <string>
#include <map>
#include <vector>
#include <cstdio>

namespace cp{
enum QuadOp{
	Error = 0,
	Assign_Int,	Assign_Var,
	Add, Sub, Mul, Div, Minus, Plus,
	JMP, JE, JNE, JG, JGE, JL, JLE
};

struct Quad{
	int op, resID, leftID, rightID;
	Quad(){}
	Quad(int _op, int _resID, int _leftID = 0, int _rightID = 0):
		op(_op), resID(_resID), leftID(_leftID), rightID(_rightID){}
};

extern char *errMsg;
extern bool defineConst(const std::string& key, int value, int &id);
extern bool declareVar(const std::string&key, int &id);
extern int getTempID();
extern bool getVarID(const std::string&key, int &id);
extern void pushTable();
extern void popTable();
extern Quad& getQuad(int pos);
extern int genQuad(int op, int resID, int leftID = 0, int rightID = 0);
extern void printQuads(FILE* fp);

}


#endif













